.global _interrupt

;------------------------------------------------------------------------------
; Fonction d'interruption à paramêtres modifiables pour le C
; int interrupt(int number, int ax, int bx, int cx, int dx)

_interrupt:
	push bp
	mov bp, sp
	push si
	mov ax, [bp+4]	; interrupt number in AL
	push ds		; self-modifying code to call the right int
	mov bx, cs
	mov ds, bx
	mov si, #intr
	mov [si+1], al	; change the 0x00 below to the content of AL
	pop ds
	mov ax, [bp+6]	; get the other params ax - dx
	mov bx, [bp+8]
	mov cx, [bp+10]
	mov dx, [bp+12]
	pop si
intr:	int #0x00	; call the int (0x00 will be changed above)
	pop bp
	ret		; return ax implicitly
